package ar.com.spsolutions.splibrary.book;

import ar.com.spsolutions.splibrary.entity.Entity;

public class BookCopy extends Entity {

	private static final long serialVersionUID = -3679441026738931399L;

	private String copyId;

	private Book book;

	private boolean available;

	private LoanBook loan;

	public void createCopyId(final String isbn, final Integer copyNumber) {
		this.setCopyId(isbn + "#" + copyNumber);
	}

	public String getCopyId() {
		return this.copyId;
	}

	public void setCopyId(final String copyId) {
		this.copyId = copyId;
	}

	public Book getBook() {
		return this.book;
	}

	public void setBook(final Book book) {
		this.book = book;
	}

	public LoanBook getLoan() {
		return this.loan;
	}

	public void setLoan(final LoanBook loan) {
		this.loan = loan;
	}

	public String getTitle() {
		return this.getBook().getTitle();
	}

	public void refun() {
		this.setAvailable(true);

	}

	public boolean isAvailable() {
		return this.available;
	}

	public void setAvailable(final boolean available) {
		this.available = available;
	}

}
